// 引入常量
import { CHANGE_A, CHANGE_B } from "./mutation-types.js";

export default {
  [CHANGE_A](state, payload) {
    state.a = payload;
  },

  [CHANGE_B](state, payload) {
    state.b = payload;
  },

  changeAB(state, payload) {
    console.log(payload);
    // 组件中提交这个 mutation this.$store.commit('changeAB', { a: 11, b: 22 })
    // !!! commit 只认两个参数，所以如果payload想要接收多个东西时，可以传递为对象
    state.a = payload.a;
    state.b = payload.b;
  },
};
